//
//  LLSystemMacrocDefine.h
//  LLFoundation
//
//  Created by my_liu on 2016/11/14.
//  Copyright © 2016年 . All rights reserved.
//

/**
 *  文件描述
 *
 *  这个文件封装了大部分系统相关的功能宏定义
 */

#import "LLSystemUitil.h"

/**
 *  去除performSelector警告
 *
 *  @param code 需要屏蔽警告的代码
 *
 *  @return
 */
#define LLSystemRemovePerformSelectorLeakWarning(code)                    \
_Pragma("clang diagnostic push")                                        \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"")     \
code;                                                                   \
_Pragma("clang diagnostic pop")

/**
 *  当前App的版本号 float型
 */
#define LLSystemAppFloatVersion [LLSystemUitil appFloatVersion]

/**
 *  当前App的版本号 字符串型
 */
#define LLSystemAppStringVersion [LLSystemUitil appStringVersion]

/**
 *  当前AppBundle版本号
 */
#define LLSystemAppBundleIntVersion [LLSystemUitil appBundleIntVersion]

/**
 *  当前AppBundle版本号
 */
#define LLSystemAppBundleStringVersion [LLSystemUitil appBundleStringVersion]

/**
 *  当前App的bundleIdentifier
 */
#define LLSystemAppBundleIdentifier [LLSystemUitil appBundleIdentifier]

/**
 *  屏幕绝对画布
 */
#define LLSystemScreenBounds [LLSystemUitil screenBounds]

/**
 *  获取系统版本号
 */
#define LLSystemFloatVersion [LLSystemUitil currentSystemFloatVersion]

/**
 *  <#Description#>
 */
#define LLSystemStringVersion [LLSystemUitil currentSystemStringVersion]

/**
 *  <#Description#>
 */
#define LLSystemName [LLSystemUitil currentSystemName]

/**
 *  <#Description#>
 */
#define LLSystemModel [LLSystemUitil currentSystemModel]

/**
 *  获取系统版本号
 */
#define LLSystemVersion [LLSystemUitil currentSystemVersion]

/**
 *  当前屏幕缩放倍数 float
 */
#define LLScreenScale [LLSystemUitil currentScreenScale]

/**
 *  当前屏幕缩放倍数 字符串
 */
#define LLScreenStringScale [LLSystemUitil currentScreenStringScale]

/**
 *  系统是否超过5.0
 */
#define LLSystemIsOver5 [LLSystemUitil isSystemVersionOver:5.0]

/**
 *  系统是否超过6.0
 */
#define LLSystemIsOver6 [LLSystemUitil isSystemVersionOver:6.0]

/**
 *  系统是否超过7.0
 */
#define LLSystemIsOver7 [LLSystemUitil isSystemVersionOver:7.0]

/**
 *  系统是否超过8.0
 */
#define LLSystemIsOver8 [LLSystemUitil isSystemVersionOver:8.0]

/**
 *  系统是否超过9.0
 */
#define LLSystemIsOver9 [LLSystemUitil isSystemVersionOver:9.0]

/**
 *  获取屏幕大小
 */
#define LLSystemScreenSize [LLSystemUitil deviceScreenSize]

/**
 *  获取屏幕宽度
 */
#define LLSystemScreenWidth [LLSystemUitil deviceScreenSize].width
/**
 *  获取屏幕高度
 */
#define LLSystemScreenHeight [LLSystemUitil deviceScreenSize].height
/**
 *  获取TableView实际高度
 */
#define LLSystemScreenHeightForMainTabBar LLSystemScreenHeight-123.0f

#define LLSystemScreenHeightForsubTabBar LLSystemScreenHeight-49.0f

/**
 *  是否iPhone4
 */
#define LLSystemiPhone4 [LLSystemUitil iPhone4Device]

/**
 *  是否iPhone5
 */
#define LLSystemiPhone5 [LLSystemUitil iPhone5Device]

/**
 *  是否iPhone6
 */
#define LLSystemiPhone6 [LLSystemUitil iPhone6Device]

/**
 *  是否iPhone6 plus
 */
#define LLSystemiPhone6Plus [LLSystemUitil iPhone6PlusDevice]

/**
 *  是否iPad
 */
#define LLSystemiPad [LLSystemUitil iPadDevice]

/**
 *  系统UINavigationBar高度
 */
#define LLSystemNavigationBarHeight [LLSystemUitil naivationBarHeight]

/**
 *  Y轴增量
 */
#define LLSystemOriginYDelta 20.f

/**
 *  AppDelegate
 */
#define LLApplicationDelegate [UIApplication shareApplication].delegate

/**
 *  创建对象弱引用
 */
#define LLWeakObject(anObject)  __weak __typeof(anObject)

/**
 *  创建对象强引用
 */
#define LLStrongObject(anObject) __strong __typeof(anObject)

/**
 *  创建self弱引用
 */
#define LLWeakSelf LLWeakObject(self)

/**
 *  创建self强引用
 */
#define LLStrongSelf LLStrongObject(LLWeakSelf)

/**
 *  系统通知中心
 */
#define LLNotificationCenter [LLSystemUitil defaultCenter]

/**
 *  系统通知中心发noti名字的通知
 */
#define LLNotificationPost(noti) [LLSystemUitil postNoti:noti]

/**
 *  系统通知中心发noti名字的通知，携带参数对象object
 */
#define LLNotificationPostObj(noti,object) [LLSystemUitil postNoti:noti withObject:object]

/**
 *  系统通知中心发noti名字的通知，携带参数对象object ,携带用户自定义信息userInfo
 */
#define LLNotificationPostObjUserInfo(noti,object,userInfo) [LLSystemUitil postNoti:noti withObject:object withUserInfo:userInfo]

/**
 *  注册通知
 */
#define LLNotificationAdd(_noParamsFunc, _notifyName)  [[NSNotificationCenter defaultCenter] \
addObserver:self \
selector:@selector(_noParamsFunc) \
name:_notifyName \
object:nil];

/**
 *  获取mainBundle
 */
#define LLMainBundle [NSBundle mainBundle]

/**
 *  获取mainBundle内名字为fileName的文件的路径
 */
#define LLMainBundlePath(fileName) [LLSystemUitil mainBundlePath:fileName]

/**
 *  获取路径为bundlePath的指定bundle中文件名为fileName的文件路径
 */
#define LLBundlePath(bundlePath,fileName) [LLSystemUitil bundle:bundlePath file:fileName]


/**
 *  运行时给一个对象添加一个成员，添加的associateKey必须是一个静态常量字符串 static NSString * const associateKey = @"";
 */
#define LLAssociateOriginWithObject(originObj,associateObj,associateKey) [LLSystemUitil originObject:originObj associateObject:associateObj byKey:associateKey]

/**
 *  通过key获取运行时加入的成员
 */
#define LLGetAssociateObject(originObj,associateKey) [LLSystemUitil associateObjectFromOrigin:originObj byKey:associateKey]

/**
 *  移除辅助成员
 */
#define LLAssociateRemove(originObj) [LLSystemUitil associateRemoveFromOrigin:originObj]

/**
 *  照相机是否可用
 */
#define LLCameraIsAvailable [LLSystemUitil cameraAvailable]

/**
 *  前置摄像头是否可用
 */
#define LLFrontCameraAvailable [LLSystemUitil frontCameraAvailable]

/**
 *  照相机闪光灯是否可用
 */
#define LLCameraFlashAvailable [LLSystemUitil cameraFlashAvailable]

/**
 *  是否支持发短信
 */
#define LLSystemCanSendSMS [LLSystemUitil canSendSMS]

/**
 *  是否支持打电话
 */
#define LLSystemCanMakePhoneCall [LLSystemUitil canMakePhoneCall]

/**
 *  当前是否有网络链接
 */
#define LLNetworkIsAvailable [LLSystemUitil networkAvailable]

/**
 *  App是否有权限访问照片库
 */
#define LLAppCanAccessPhotoLibrary [LLSystemUitil isAppPhotoLibraryAccessAuthorized]

/**
 *  App是否有权限访问相机
 */
#define LLAppCanAccessCamera [LLSystemUitil isAppCameraAccessAuthorized]

/**
 *  获取屏幕Y轴起始点
 */
#define LLAppSelfViewFrameOrangeY [LLSystemUitil getSelfViewFrameOrangeY]

/**
 *  系统是否 >=7.0 <7.1
 */
#define LLSystemVersionIs7 [LLSystemUitil isSystemVersionIs7]
